package jfox.platform.common;

import javax.ejb.EJB;

import jfox.platform.function.bo.ModuleBO;
import jfox.platform.infrastructure.SuperAction;
import org.jfox.framework.annotation.Service;
import org.jfox.mvc.Invocation;
import org.jfox.mvc.InvocationContext;
import org.jfox.mvc.annotation.ActionMethod;
import org.jfox.mvc.validate.LongValidation;

/**
 * @author <a href="mailto:jfox.young@gmail.com">Young Yang</a>
 */
@Service(id="home")
public class HomeAction extends SuperAction {

    @EJB
    ModuleBO moduleBO;

    @ActionMethod(name="index", successView = "new_contact.vhtml")
    public void indexPage(InvocationContext invocationContext) throws Exception{

    }

    @ActionMethod(name="today", successView = "new_contact.vhtml")
    public void todayPage(InvocationContext invocationContext) throws Exception{

    }

/* 
    @ActionMethod(name="module", successView = "module.vhtml")
    public void modulePage(InvocationContext invocationContext) throws Exception {
        ModuleInvocation invocation = (ModuleInvocation)invocationContext.getInvocation();
        long moduleId = invocation.getId();
        Module module = moduleBO.getModuleById(moduleId);
        String bindAction = module.getBindAction();
        // forward to module bind_action url
        invocationContext.getPageContext().setTargetView(bindAction);
    }
*/


    public static class ModuleInvocation extends Invocation {
        @LongValidation
        private long id;

        public long getId() {
            return id;
        }

        public void setId(long id) {
            this.id = id;
        }
    }
}
